from kubernetes import client, config

# 加载 Kubernetes 配置
config.load_kube_config()

# 创建 Kubernetes API 客户端
v1 = client.CoreV1Api()

# 指定 Pod 的命名空间和名称
namespace = 'your-namespace'
name = 'your-pod-name'

# 重启 Pod
body = {'spec': {'containers': [{'name': 'your-container-name', 'restartCount': 0}]}}
v1.patch_namespaced_pod(name, namespace, body)

